package icu.wangrui.bookstore.config;

import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/*
* 实现拦截器就实现HandlerInterceptor接口
* 返回false就是不通过 true就是通过
* */
class AdminLoginHandelInterceptor implements HandlerInterceptor {
/*    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
       //登录成功应该有用户的session
        Object loginAdmin = request.getSession().getAttribute("loginAdmin");
        if (loginAdmin == null) {
            request.setAttribute("msg","没有权限请先登录");
            request.getRequestDispatcher("/adminlogin.html").forward(request,response);
            return false;
        }else {
            return true;
        }
    }*/


}
